dgb: rewire get_pool_attempts_per_second onto coin/ SSOT (#407 follow-on) - #503
Merged
Conversation
…-on) ShareTracker::get_pool_attempts_per_second performed the chain walk and then inlined the window arithmetic (dist<2/near/far guards, near_ts-far_ts span clamped to 1, integer attempts/span divide) -- a duplicate of the KAT-pinned coin/pool_attempts_per_second.hpp SSOT lifted in #407. Delegate the resolved-endpoint arithmetic to dgb::compute_pool_attempts_per_second: the member still owns the chain walk (skip-list far lookup, get_delta work sum, timestamp reads) and hands a PoolAttemptsInputs to the SSOT. Byte-identical to the prior inline path -- same int32_t span type, same uint288 divide, same zero returns on the three guard conditions. Phase-B SSOT consolidation: turns the header-only lift into a live production delegation so the inline copy can no longer drift from the oracle. dgb_share_test 34/34 (exercises share-target derivation through the member); dgb_pool_attempts_per_second_test 10/10. FENCED dgb/, no consensus change.
frstrtr
pushed a commit
that referenced
this pull request
Jul 14, 2026
…n hardening) Clears the 8 real CodeQL security alerts on frstrtr/c2pool. Triaged + independently re-reviewed: 1 CRITICAL is a genuine fix, 2 HIGH get defense-in-depth, 5 HIGH are getenv-rooted false positives (dismissed separately with justification). - #490 CRITICAL cpp/potentially-dangerous-function (src/core/log.cpp:163): std::gmtime returns a pointer into a shared static tm and is not reentrant. Replace with gmtime_r (POSIX) / gmtime_s (MSVC) into a local tm. Only gmtime/localtime call in src/. - #502/#503 HIGH cpp/path-injection (coin_peer_manager.hpp db_path()): m_symbol is a hardcoded ticker literal at every production ctor site (traced through all callers; no network->filename path exists), but add an alphanumeric-only guard so a future caller cannot inject a path component. Legitimate tickers (LTC/DOGE/DGB/DASH/BTC/NMC/...) are all alnum -> no on-disk filename change. - Rider: core::filesystem::config_path() dereferenced getenv() without a null check -> std::filesystem::path(nullptr) is UB if HOME/APPDATA is unset. Fall back to '.'. The other 5 path-injection alerts (#507 node.cpp:2199, #506/#505/#504 payout_manager.cpp:224/261/284, #501 auto_ratchet.hpp:309) all build a path from config_path() (getenv HOME/APPDATA) + a hardcoded basename, never from network/peer/miner input -> dismissed as false positive.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase-B SSOT consolidation: production rewire of get_pool_attempts_per_second (#407 follow-on)
coin/pool_attempts_per_second.hppwas lifted in #407 as a KAT-pinned SSOT but left header-only --ShareTracker::get_pool_attempts_per_secondstill inlined a duplicate of the same window arithmetic. This wires the member onto the SSOT so the inline copy can no longer drift from the oracle.Change (byte-identical)
get_deltawork/min_work sum, timestamp reads).dgb::compute_pool_attempts_per_second(PoolAttemptsInputs), which owns the three guard returns (dist<2 / near absent / far unresolved -> 0) and thenear_ts - far_tsspan (clamped to 1) integer divide.int32_tspan type, sameuint288divide -- provably value-identical to the prior inline path.Evidence
dgb_share_test34/34 (exercises share-target derivation through the member at share_tracker.hpp:1439/1658).dgb_pool_attempts_per_second_test10/10.Scope
FENCED
src/impl/dgb/only; diagnostic/hashrate-estimation path; no consensus surface, nosrc/impl/dogeedits, no node seam. NO self-merge -- integrator diffs value before tap.